package com.um.springboot.starter.core;

import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Component;

/**
 * @author 甘天伟
 * @date 2025/3/7
 * 版权所有 广州优匠科技有限公司
 */
@Component
public class StringObjectRedisTemplate extends RedisTemplate<String, Object> {

    public StringObjectRedisTemplate(RedisConnectionFactory connectionFactory) {
        setKeySerializer(RedisSerializer.string());
        setValueSerializer(RedisSerializer.java());
        setHashKeySerializer(RedisSerializer.string());
        setHashValueSerializer(RedisSerializer.java());

        setConnectionFactory(connectionFactory);
        afterPropertiesSet();
    }

}
